Use a GString instead of static buffer to reduce .bss by 8kb. (#336784)
authorBehdad Esfahbod <behdad@gnome.org>
Sat, 1 Apr 2006 20:06:15 +0000 (20:06 +0000)
committerBehdad Esfahbod <behdad@src.gnome.org>
Sat, 1 Apr 2006 20:06:15 +0000 (20:06 +0000)
2006-04-01  Behdad Esfahbod  <behdad@gnome.org>

        * gtk/gtkfilesel.c (gtk_file_selection_get_filename): Use a GString
        instead of static buffer to reduce .bss by 8kb. (#336784)

ChangeLog
ChangeLog.pre-2-10
gtk/gtkfilesel.c

index 2b07962d1564f33e60b10d36a614fdd8e1b6716f..4a118a3a8ca707e9d244a20bc43072a8286193b2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-04-01  Behdad Esfahbod  <behdad@gnome.org>
+
+       * gtk/gtkfilesel.c (gtk_file_selection_get_filename): Use a GString
+       instead of static buffer to reduce .bss by 8kb. (#336784)
+
 2006-04-01  Dom Lachowicz <cinamod@hotmail.com>
 
        * modules/engines/ms-windows/msw_style.c (draw_hline): Emulate WinXP's
index 2b07962d1564f33e60b10d36a614fdd8e1b6716f..4a118a3a8ca707e9d244a20bc43072a8286193b2 100644 (file)
@@ -1,3 +1,8 @@
+2006-04-01  Behdad Esfahbod  <behdad@gnome.org>
+
+       * gtk/gtkfilesel.c (gtk_file_selection_get_filename): Use a GString
+       instead of static buffer to reduce .bss by 8kb. (#336784)
+
 2006-04-01  Dom Lachowicz <cinamod@hotmail.com>
 
        * modules/engines/ms-windows/msw_style.c (draw_hline): Emulate WinXP's
index 0d7325d1b226ee711a22951a55c7cc9ff636a82f..a7e6e18125d3bddc3a74acce1e47d555e41ff9c6 100644 (file)
@@ -1243,7 +1243,7 @@ G_CONST_RETURN gchar*
 gtk_file_selection_get_filename (GtkFileSelection *filesel)
 {
   static const gchar nothing[2] = "";
-  static gchar something[MAXPATHLEN*2+1];
+  static GString *something;
   char *sys_filename;
   const char *text;
 
@@ -1260,10 +1260,14 @@ gtk_file_selection_get_filename (GtkFileSelection *filesel)
       g_free (fullname);
       if (!sys_filename)
        return nothing;
+      if (!something)
+        something = g_string_new (sys_filename);
+      else
+        g_string_assign (something, sys_filename);
       strncpy (something, sys_filename, sizeof (something) - 1);
-      something[sizeof (something) - 1] = '\0';
       g_free (sys_filename);
-      return something;
+
+      return something->str;
     }
 
   return nothing;